package memorphic.slide.plugin.generators;

 public class ControllerTemplate extends SlideBaseTemplate
 {

 	
  protected static String nl;
  public static synchronized ControllerTemplate create(String lineSeparator)
  {
    nl = lineSeparator;
    ControllerTemplate result = new ControllerTemplate();
    nl = null;
    return result;
  }

  public final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
  protected final String TEXT_1 = "package ";
  protected final String TEXT_2 = NL + "{" + NL + "\timport memorphic.slide.ControllerBase;" + NL + "" + NL + "\tpublic class ";
  protected final String TEXT_3 = " extends ControllerBase" + NL + "\t{" + NL + "\t\t" + NL + "\t\t" + NL + "\t\tprivate var context:";
  protected final String TEXT_4 = ";" + NL + "\t\t" + NL + "\t\t" + NL + "\t\tpublic function ";
  protected final String TEXT_5 = "(context:";
  protected final String TEXT_6 = ")" + NL + "\t\t{" + NL + "\t\t\tsuper(context);" + NL + "\t\t\tthis.context = context;" + NL + "\t\t}" + NL + "\t\t" + NL + "\t}" + NL + "}";

/* (non-javadoc)
    * @see IGenerator#generate(Object)
    */
public String generate(Object argument)
  {
    final StringBuffer stringBuffer = new StringBuffer();
    stringBuffer.append(TEXT_1);
    stringBuffer.append( featurePackage );
    stringBuffer.append(TEXT_2);
    stringBuffer.append( controllerClassName );
    stringBuffer.append(TEXT_3);
    stringBuffer.append( contextClassName );
    stringBuffer.append(TEXT_4);
    stringBuffer.append( controllerClassName );
    stringBuffer.append(TEXT_5);
    stringBuffer.append( contextClassName );
    stringBuffer.append(TEXT_6);
    return stringBuffer.toString();
  }
}